<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java 基本数据类型详解</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        .type-badge {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-weight: 600;
            display: inline-block;
            margin-bottom: 0.5rem;
        }
        .first-letter::first-letter {
            font-size: 3rem;
            font-weight: 700;
            float: left;
            line-height: 1;
            margin-right: 0.5rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        .data-type-icon {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            margin-bottom: 1rem;
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .animate-fadeInUp {
            animation: fadeInUp 0.6s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 text-center">
            <h1 class="text-5xl md:text-6xl font-bold mb-4 animate-fadeInUp">
                Java 基本数据类型
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90 animate-fadeInUp" style="animation-delay: 0.2s">
                深入理解 Java 编程语言的基石
            </p>
            <div class="flex justify-center space-x-4 animate-fadeInUp" style="animation-delay: 0.4s">
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-memory mr-2"></i>8 种基本类型
                </span>
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-microchip mr-2"></i>固定内存占用
                </span>
            </div>
        </div>
    </section>

    <!-- Introduction Section -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6 max-w-4xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">
                    <i class="fas fa-book-open text-purple-600 mr-3"></i>概述
                </h2>
            </div>
            <div class="bg-gray-50 rounded-2xl p-8 shadow-lg">
                <p class="text-lg text-gray-700 leading-relaxed first-letter">
                    在 Java 中，基本数据类型有 8 种，每种基本数据类型占用的内存字节数是固定的。这些基本类型是 Java 语言的基础构建块，直接存储在栈内存中，具有高效的性能表现。理解这些数据类型的特性对于编写高质量的 Java 程序至关重要。
                </p>
            </div>
        </div>
    </section>

    <!-- Data Visualization -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center text-gray-800 mb-12">
                <i class="fas fa-sitemap text-purple-600 mr-3"></i>数据类型关系图
            </h2>
            <div class="bg-white rounded-2xl p-8 shadow-lg">
                <div class="mermaid">
                    graph TD
                        A[Java 基本数据类型] --> B[数值类型]
                        A --> C[字符类型]
                        A --> D[布尔类型]
                        B --> E[整数类型]
                        B --> F[浮点类型]
                        E --> G[byte<br/>1字节]
                        E --> H[short<br/>2字节]
                        E --> I[int<br/>4字节]
                        E --> J[long<br/>8字节]
                        F --> K[float<br/>4字节]
                        F --> L[double<br/>8字节]
                        C --> M[char<br/>2字节]
                        D --> N[boolean<br/>1位/1字节]
                        
                        style A fill:#667eea,stroke:#764ba2,stroke-width:3px,color:#fff
                        style B fill:#48bb78,stroke:#38a169,stroke-width:2px,color:#fff
                        style C fill:#ed8936,stroke:#dd6b20,stroke-width:2px,color:#fff
                        style D fill:#e53e3e,stroke:#c53030,stroke-width:2px,color:#fff
                </div>
            </div>
        </div>
    </section>

    <!-- Data Types Grid -->
    <section class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center text-gray-800 mb-12">
                <i class="fas fa-th-large text-purple-600 mr-3"></i>详细说明
            </h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
                <!-- byte -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-cube"></i>
                    </div>
                    <span class="type-badge">整数类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">byte</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>1 字节（8 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>-128 到 127</p>
                    </div>
                </div>

                <!-- short -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-cubes"></i>
                    </div>
                    <span class="type-badge">整数类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">short</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>2 字节（16 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>-32,768 到 32,767</p>
                    </div>
                </div>

                <!-- int -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-box"></i>
                    </div>
                    <span class="type-badge">整数类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">int</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>4 字节（32 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>-2<sup>31</sup> 到 2<sup>31</sup>-1</p>
                    </div>
                </div>

                <!-- long -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-boxes"></i>
                    </div>
                    <span class="type-badge">整数类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">long</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>8 字节（64 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>-2<sup>63</sup> 到 2<sup>63</sup>-1</p>
                    </div>
                </div>

                <!-- float -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-water"></i>
                    </div>
                    <span class="type-badge">浮点类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">float</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>4 字节（32 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>约 1.4E-45 到 3.4E+38</p>
                        <p class="text-sm text-gray-500">单精度浮点数</p>
                    </div>
                </div>

                <!-- double -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-tint"></i>
                    </div>
                    <span class="type-badge">浮点类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">double</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>8 字节（64 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>约 4.9E-324 到 1.7E+308</p>
                        <p class="text-sm text-gray-500">双精度浮点数</p>
                    </div>
                </div>

                <!-- char -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-font"></i>
                    </div>
                    <span class="type-badge">字符类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">char</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>2 字节（16 位）</p>
                        <p><i class="fas fa-arrows-alt-h text-purple-500 mr-2"></i><strong>范围：</strong>0 到 65,535</p>
                        <p class="text-sm text-gray-500">Unicode 编码</p>
                    </div>
                </div>

                <!-- boolean -->
                <div class="card-hover bg-white rounded-xl shadow-lg p-6">
                    <div class="data-type-icon">
                        <i class="fas fa-toggle-on"></i>
                    </div>
                    <span class="type-badge">布尔类型</span>
                    <h3 class="text-2xl font-bold text-gray-800 mb-3">boolean</h3>
                    <div class="space-y-2 text-gray-600">
                        <p><i class="fas fa-memory text-purple-500 mr-2"></i><strong>占用：</strong>JVM 实现相关</p>
                        <p><i class="fas fa-info-circle text-purple-500 mr-2"></i><strong>说明：</strong>数组中通常占 1 字节</p